package com.chuangke.sinotrukbudgetapi.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.chuangke.sinotrukbudgetapi.service.BudgetApiService;
import com.chuangke.system.annotation.ApiLogDoc;

/**
 * 预算对外接口
 *
 * @author chuangke
 * @date "2022-11-15"
 */
@RestController
@RequestMapping("/budget")
public class BudgetApiController {

    @Autowired
    private BudgetApiService budgetApiService;

    /**
     * 预算接收接口
     *
     * @param budgetJson
     * @return
     */
    @PostMapping("/send")
    @ApiLogDoc(apiId = "BPCI002_A", apiName = "接收bpc预算同步接口", reqType = "IN")
    public Object list(@RequestBody String budgetJson) {
        return budgetApiService.receiveBudgetData(budgetJson);
    }

    /**
     * 接收结果回写
     *
     * @param budgetJson
     * @return
     */
    @PostMapping("/writebackreceiveresult")
    public Object writeBackReceiveResult(@RequestBody String budgetJson) {
        return budgetApiService.writeBackReceiveResult(null);
    }

    /**
     * 审批结果回写
     *
     * @param budgetJson
     * @return
     */
    @PostMapping("/writebackauditbudget")
    public Object writeBackAuditBudget(@RequestBody String budgetJson) {
        return budgetApiService.writeBackAuditBudget();
    }

}
